package com.oscar.practice.shiro.model.user;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.oscar.practice.shiro.model.BaseInfo;

/**
 * 权限
 *
 * @author tongyufu
 *
 */
public class PermissionInfo extends BaseInfo {

    private static final long    serialVersionUID = 1L;
    private Integer              id;
    private String               name;
    private String               type;                                              //权限类型(0:菜单; 1:按钮)
    private String               url;
    private Integer              parentId;
    private String               description;
    private List<PermissionInfo> children         = new ArrayList<PermissionInfo>();

    /**转换成easy-ui的tree结构*/
    public Map<String, Object> transToTreeMap() {
        Map<String, Object> leaf = new HashMap<>();
        leaf.put("id", this.id);
        leaf.put("text", this.name);
        return leaf;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<PermissionInfo> getChildren() {
        return children;
    }

    public void setChildren(List<PermissionInfo> children) {
        this.children = children;
    }

}
